home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / appsrcs.zip / MORSETUP.ZIP / APPTOOLS.C < prev    next >
C/C++ Source or Header  |  1993-05-07  |  4KB  |  109 lines

  1. #define STRICT
  2. #include <windows.h>
  3. #include <windowsx.h>
  4. #include <shellapi.h>
  5. #include <io.h>
  6. #include <stdarg.h>
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9. #include <direct.h>
  10. #include <string.h>
  11. #include "morsetup.h"
  12.  
  13. /*--------------------------------------------------------------------------*/
  14. /* FUNCTION: OkMsgBox(char *szCaption, char *szFormat, ...)            */
  15. /*                                        */
  16. /* PURPOSE:  Display in an OKmessageBox a given text                */
  17. /*--------------------------------------------------------------------------*/
  18. VOID OkMsgBox(char *szCaption, char *szFormat, ...)
  19.     {
  20.     char szBuffer[256];
  21.     char *pArguments;
  22.  
  23.     pArguments = (char *) &szFormat + sizeof(szFormat);
  24.     vsprintf(szBuffer, szFormat, pArguments);
  25.     MessageBeep(0);
  26.     MessageBox(NULL, szBuffer, szCaption, MB_OK);
  27.     }
  28.  
  29. /*--------------------------------------------------------------------------*/
  30. /* FUNCTION: ErrorMsgBox(char *szCaption, char *szFormat, ...)            */
  31. /*                                        */
  32. /* PURPOSE:  Display in an ErrormessageBox a given text                */
  33. /*--------------------------------------------------------------------------*/
  34. VOID ErrorMsgBox(char *szCaption, char *szFormat, ...)
  35.     {
  36.     char szBuffer[256];
  37.     char *pArguments;
  38.  
  39.     pArguments = (char *) &szFormat + sizeof(szFormat);
  40.     vsprintf(szBuffer, szFormat, pArguments);
  41.     MessageBeep(MB_ICONEXCLAMATION);
  42.     MessageBox(NULL, szBuffer, szCaption, MB_OK | MB_ICONEXCLAMATION);
  43.     }
  44.  
  45. /*--------------------------------------------------------------------------*/
  46. VOID LoadIconFromFile(HICON *hIcon, int i)
  47.     {
  48.     MaxIconNumber[i] = (int) ExtractIcon(hInst, AppButton[i].IcoName, -1);
  49.     AppButton[i].IconNumber = min(MaxIconNumber[i]-1, AppButton[i].IconNumber);
  50.     *hIcon = ExtractIcon(hInst, AppButton[i].IcoName, AppButton[i].IconNumber);
  51.     if(*hIcon == (HICON) 1)
  52.     *hIcon = NULL;
  53.     }
  54.  
  55. /*--------------------------------------------------------------------------*/
  56. HBRUSH SetColorLightGray(HWND hwnd, HDC hdc)
  57.     {
  58.     POINT point;
  59.  
  60.     SetBkColor(hdc, GetSysColor(COLOR_BTNFACE));
  61.     SetTextColor(hdc, GetSysColor(COLOR_BTNTEXT));
  62.     point.x = point.y = 0;
  63.     ClientToScreen(hwnd, &point);
  64.     SetBrushOrg(hdc, point.x, point.y);
  65.     return GetStockBrush(LTGRAY_BRUSH);
  66.     }
  67.  
  68. /*--------------------------------------------------------------------------*/
  69. HBRUSH SetColorStaticText(HWND hwnd, HDC hdc)
  70.     {
  71.     POINT point;
  72.  
  73.     SetBkColor(hdc, GetSysColor(COLOR_BTNFACE));
  74.     SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHT));
  75.     point.x = point.y = 0;
  76.     ClientToScreen(hwnd, &point);
  77.     SetBrushOrg(hdc, point.x, point.y);
  78.     return GetStockBrush(LTGRAY_BRUSH);
  79.     }
  80.  
  81. /*-------------------------------------------------------------------------*/
  82. VOID LoadExeIcon(HICON *hIcon, int iCurrent)
  83.     {
  84.     strcpy(szBuffer, AppButton[iCurrent].IcoName);
  85.     strcpy(AppButton[iCurrent].IcoName, AppButton[iCurrent].ProgName);
  86.     DestroyIcon(*hIcon);
  87.     LoadIconFromFile(hIcon, iCurrent);
  88.     if(*hIcon == NULL)
  89.     {
  90.     strcpy(AppButton[iCurrent].IcoName, szBuffer);
  91.     LoadIconFromFile(hIcon, iCurrent);
  92.     }
  93.     else
  94.     AppButton[iCurrent].ButtonLook = 1;
  95.     Edit_SetText(hwndEdit[3], AppButton[iCurrent].IcoName);
  96.     UpdateNextButtons(iCurrent);
  97.     }
  98.  
  99. /*-------------------------------------------------------------------------*/
  100. VOID PASCAL SetCaption(HWND hWndCaption, LPSTR CaptionName)
  101.     {
  102.     strcpy(szBuffer, CaptionName);
  103.     strcat(szBuffer, " - ");
  104.     strcat(szBuffer, "[");
  105.     strcat(szBuffer, AppSystem.SectionName);
  106.     strcat(szBuffer, "]");
  107.     SetWindowText(hWndCaption, szBuffer);
  108.     }
  109.